package com.itheima.collectionDemo;

import java.util.ArrayList;
import java.util.List;
import java.util.ListIterator;

public class ListIteratorDemo {
    public static void main(String[] args) {
        List<String> l = new ArrayList<>();

        l.add("zhangsan");
        l.add("lisi");
        l.add("wanghu");

        ListIterator<String> it = l.listIterator();
        while(it.hasNext()){
            String str = it.next();
            if("lisi".equals(str)){
                it.add("qqq");
            }
            System.out.println(str);
        }
        System.out.println(l);

    }
}
